//菜单权限Vuex
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default ({
  namespaced: true, //命名空间, 方便区分commit中间的方法
  state : {
    menuList : [],
    authorizationList : []
  },

  //同步执行
  mutations : {
    INIT_ROUTER (state, data) {
      state.menuList = data
    },
    REMOVE_ROUTER (state) {
      state.menuList = []
    },
    SET_AUTHORIZATION(state, data) {
      state.authorizationList = data
      localStorage.setItem("authorizationList", data)
    },
    REMOVE_AUTHORIZATION(state) {
      state.authorizationList = []
      localStorage.removeItem("authorizationList");
    }
  },

  //异步执行
  actions : {
  }
})
